package com.tuling.apollo;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;


@SpringBootApplication
@EnableApolloConfig
@EnableEurekaClient
public class SpringbootApolloApplication {

    /**
     * @param args
     */
    public static void main(String[] args) throws InterruptedException {
        SpringApplication.run(SpringbootApolloApplication.class, args);

        //获取的是application命名空间
        Config config = ConfigService.getAppConfig();
        System.out.println(config.getProperty("test", null));
        //获取自定义的命名空间
        Config mysqlConfig = ConfigService.getConfig("com.crungoo.mysql");
        System.out.println(mysqlConfig.getProperty("serverName", null));


    }

}
